home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11303 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  768 b 

  1. Path: transformer.pti-us.com.!news
  2. From: Walt Dixon <wv.dixon@pti-us.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Beginer C please help me
  5. Date: 22 Mar 1996 22:27:38 GMT
  6. Organization: Power Technologies Inc.
  7. Message-ID: <4iv9gq$cpb@transformer.pti-us.com>
  8. References: <DoLCFx.B7x.0.bloor@torfree.net>
  9. NNTP-Posting-Host: virgil.pti-us.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; SunOS 5.3 sun4m)
  14. X-URL: news:DoLCFx.B7x.0.bloor@torfree.net
  15.  
  16. The problem you are seeing is due the the fact that both of the operands
  17. are integers, yeilding an integer result.  If you are looking for
  18. a floating point result I suggest casting either opperand to a float.
  19.  
  20. n = (float)9/5
  21.  
  22. or n = 9.0/5;
  23.  
  24. walt
  25.  
  26.